#include "timer.hpp"
#include <iostream>
#include <thread>
#ifdef _WIN32
    #include <windows.h>
#endif // _WIN32

int func1(int &x)
{
    x++;
    std::cout << "func1, x: " << x << std::endl;
    return 0;
}

int func2(int &x)
{
    x++;
    std::cout << "func2, x: " << x << std::endl;
    return 0;
}

void Test()
{
    Timer timer;

    int a = 45;
    std::cout << "--- start period timer ----" << std::endl;
    timer.Start(1000, 100, [&a]() {
        func1(a);
    });
    ThreadFunc::SleepFor(5000);
    timer.Stop();
    std::cout << "--- stop period timer ----" << std::endl;
}

int main()
{
#ifdef _WIN32
    SetConsoleCP(65001);
    SetConsoleOutputCP(65001);
#endif
    Test();
}
